import java.util.Scanner;

public class Demo3 {
    private static boolean running = true;
    public static void main(String[] args) {

        Thread t = new Thread(() -> {
           Thread cur = Thread.currentThread();
           while(!cur.isInterrupted()) {
               System.out.println("hello thread");
               try {
                   Thread.sleep(100_000);
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
           }
        });
        t.start();
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入0，表示让线程t结束：");
        int a = scanner.nextInt();
        if(a == 0){
            running = false;
        }
    }
}






